const axios = require('axios');
const schedule = require('node-schedule');
const dayjs = require('dayjs');

dayjs.locale('zh-cn');

const weekday = require('dayjs/plugin/weekday');

dayjs.extend(weekday);

const sendMsg = () => {
  const time = dayjs().weekday(2).format('YYYY-MM-DD');
  axios.post('http://59.110.10.239:8083/api/online/sendMsg', { online_time: time });
};

// 定义每周一、二、三、四、五的上午9点半触发
const morningJob = schedule.scheduleJob('30 18 * * 2', function () {
  console.log('下午6点半');
  sendMsg();
});
